From 530e1d180d282cf8d2db52386d3c023bec1ce5bd Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 3 Aug 2015 10:04:22 -0700 Subject: [PATCH] Update dependencies and Rust that's used * Picks up a few breaking changes to dependency APIs, notably the tar-rs changes and git2-rs changes. * Builds should now work with VS 2015 --- .travis.yml | 7 +- Cargo.lock | 173 ++++++++++++++------------- Cargo.toml | 8 +- appveyor.yml | 2 +- src/cargo/ops/cargo_package.rs | 2 +- src/cargo/sources/git/utils.rs | 43 ++++--- src/rustversion.txt | 2 +- tests/support/git.rs | 5 +- tests/support/registry.rs | 8 +- tests/test_cargo_build_auth.rs | 15 ++- tests/test_cargo_compile.rs | 3 +- tests/test_cargo_compile_git_deps.rs | 9 +- tests/test_cargo_doc.rs | 6 +- tests/test_cargo_package.rs | 10 +- tests/test_cargo_publish.rs | 5 +- 15 files changed, 166 insertions(+), 132 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac0abad5f..318daa59b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,9 @@ branches: addons: apt: + sources: + - kalakris-cmake packages: - - g++-multilib - - lib32stdc++6 + - cmake + - g++-multilib + - lib32stdc++6 diff --git a/Cargo.lock b/Cargo.lock index 892faedac..f945f715d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,30 +6,30 @@ dependencies = [ "bufstream 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "crates-io 0.1.0", "curl 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.69 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.70 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "git2-curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "git2-curl 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "threadpool 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -37,13 +37,13 @@ name = "advapi32-sys" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -59,12 +59,20 @@ name = "bufstream" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cmake" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crates-io" version = "0.1.0" dependencies = [ "curl 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -75,7 +83,7 @@ dependencies = [ "curl-sys 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -84,20 +92,20 @@ name = "curl-sys" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.69" +version = "0.6.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -107,7 +115,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -115,9 +123,9 @@ name = "filetime" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -131,31 +139,31 @@ dependencies = [ [[package]] name = "gcc" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "git2" -version = "0.2.13" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "git2-curl" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -170,16 +178,16 @@ name = "hamcrest" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -189,44 +197,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libgit2-sys" -version = "0.2.20" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cmake 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libssh2-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libssh2-sys 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libressl-pnacl-sys" -version = "2.1.5" +version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pnacl-build-helper 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libssh2-sys" -version = "0.1.27" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libz-sys" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -255,17 +264,17 @@ name = "miniz-sys" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -278,23 +287,23 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.6.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libressl-pnacl-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pnacl-build-helper" -version = "1.4.0" +version = "1.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -302,35 +311,37 @@ dependencies = [ [[package]] name = "rand" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-serialize" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "semver" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -340,9 +351,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tar" -version = "0.2.14" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "filetime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -351,7 +363,7 @@ name = "tempdir" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -359,8 +371,8 @@ name = "term" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -370,19 +382,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "time" -version = "0.1.26" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "toml" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -391,16 +404,16 @@ version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi-build" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml index ca5a971cb..16aacb347 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,19 +23,19 @@ docopt = "0.6" env_logger = "0.3" filetime = "0.1" flate2 = "0.2" -git2 = "0.2" -git2-curl = "0.2" +git2 = "0.3" +git2-curl = "0.3" glob = "0.2" kernel32-sys = "0.1" libc = "0.1" -libgit2-sys = "0.2" +libgit2-sys = "0.3" log = "0.3" num_cpus = "0.2" regex = "0.1" crates-io = { path = "src/crates-io", version = "0.1" } rustc-serialize = "0.3" semver = "0.1" -tar = { version = "0.2", features = ["nightly"] } +tar = "0.3" term = "0.2" threadpool = "0.1" time = "0.1" diff --git a/appveyor.yml b/appveyor.yml index 5316552ab..18fc5f2fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ install: build: false test_script: - - cargo test + - cargo test -- --nocapture branches: only: diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 7c6c04c1a..bcd74f460 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -136,7 +136,7 @@ fn tar(pkg: &Package, src: &PathSource, config: &Config, })); let path = format!("{}-{}{}{}", pkg.name(), pkg.version(), path::MAIN_SEPARATOR, relative); - try!(ar.append(&path, &mut file).chain_error(|| { + try!(ar.append_file(&path, &mut file).chain_error(|| { internal(format!("could not archive source file `{}`", relative)) })); } diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index c1d0b6068..492bf9533 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -112,13 +112,13 @@ impl GitRemote { let repo = match git2::Repository::open(into) { Ok(repo) => { try!(self.fetch_into(&repo).chain_error(|| { - internal(format!("failed to fetch into {}", into.display())) + human(format!("failed to fetch into {}", into.display())) })); repo } Err(..) => { try!(self.clone_into(into).chain_error(|| { - internal(format!("failed to clone into: {}", into.display())) + human(format!("failed to clone into: {}", into.display())) })) } }; @@ -365,11 +365,21 @@ fn with_authentication(url: &str, cfg: &git2::Config, mut f: F) // // * After the above two have failed, we just kinda grapple attempting to // return *something*. + // + // Note that we keep track of the number of times we've called this callback + // because libgit2 will repeatedly give us credentials until we give it a + // reason to not do so. If we've been called once and our credentials failed + // then we'll be called again, and in this case we assume that the reason + // was because the credentials were wrong. let mut cred_helper = git2::CredentialHelper::new(url); cred_helper.config(cfg); - let mut cred_error = false; - let ret = f(&mut |url, username, allowed| { - let creds = if allowed.contains(git2::SSH_KEY) || + let mut called = 0; + let res = f(&mut |url, username, allowed| { + called += 1; + if called >= 2 { + return Err(git2::Error::from_str("no authentication available")) + } + if allowed.contains(git2::SSH_KEY) || allowed.contains(git2::USERNAME) { let user = username.map(|s| s.to_string()) .or_else(|| cred_helper.username.clone()) @@ -385,16 +395,14 @@ fn with_authentication(url: &str, cfg: &git2::Config, mut f: F) git2::Cred::default() } else { Err(git2::Error::from_str("no authentication available")) - }; - cred_error = creds.is_err(); - creds + } }); - if cred_error { - ret.chain_error(|| { - human("Failed to authenticate when downloading repository") + if called > 0 { + res.chain_error(|| { + human("failed to authenticate when downloading repository") }) } else { - ret + res } } @@ -404,11 +412,12 @@ pub fn fetch(repo: &git2::Repository, url: &str, with_authentication(url, &try!(repo.config()), |f| { let mut cb = git2::RemoteCallbacks::new(); - cb.credentials(|a, b, c| f(a, b, c)); - let mut remote = try!(repo.remote_anonymous(&url, Some(refspec))); - try!(remote.add_fetch("refs/tags/*:refs/tags/*")); - remote.set_callbacks(cb); - try!(remote.fetch(&["refs/tags/*:refs/tags/*", refspec], None)); + cb.credentials(f); + let mut remote = try!(repo.remote_anonymous(&url)); + let mut opts = git2::FetchOptions::new(); + opts.remote_callbacks(cb) + .download_tags(git2::AutotagOption::All); + try!(remote.fetch(&[refspec], Some(&mut opts), None)); Ok(()) }) } diff --git a/src/rustversion.txt b/src/rustversion.txt index 572b76a26..49b1509a7 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-07-22 +2015-08-13 diff --git a/tests/support/git.rs b/tests/support/git.rs index 082f07fab..a84e5287d 100644 --- a/tests/support/git.rs +++ b/tests/support/git.rs @@ -97,10 +97,9 @@ pub fn add_submodule<'a>(repo: &'a git2::Repository, url: &str, let path = path.to_str().unwrap().replace(r"\", "/"); let mut s = repo.submodule(url, Path::new(&path), false).unwrap(); let subrepo = s.open().unwrap(); + subrepo.remote_add_fetch("origin", "refs/heads/*:refs/heads/*").unwrap(); let mut origin = subrepo.find_remote("origin").unwrap(); - origin.add_fetch("refs/heads/*:refs/heads/*").unwrap(); - origin.fetch(&[], None).unwrap(); - origin.save().unwrap(); + origin.fetch(&[], None, None).unwrap(); subrepo.checkout_head(None).unwrap(); s.add_finalize().unwrap(); return s; diff --git a/tests/support/registry.rs b/tests/support/registry.rs index 583916fdb..861bc5a11 100644 --- a/tests/support/registry.rs +++ b/tests/support/registry.rs @@ -62,10 +62,10 @@ pub fn mock_archive(name: &str, version: &str, deps: &[(&str, &str, &str)]) { fs::create_dir_all(dst.parent().unwrap()).unwrap(); let f = File::create(&dst).unwrap(); let a = Archive::new(GzEncoder::new(f, Default)); - a.append(&format!("{}-{}/Cargo.toml", name, version), - &mut File::open(&p.root().join("Cargo.toml")).unwrap()).unwrap(); - a.append(&format!("{}-{}/src/lib.rs", name, version), - &mut File::open(&p.root().join("src/lib.rs")).unwrap()).unwrap(); + a.append_file(&format!("{}-{}/Cargo.toml", name, version), + &mut File::open(&p.root().join("Cargo.toml")).unwrap()).unwrap(); + a.append_file(&format!("{}-{}/src/lib.rs", name, version), + &mut File::open(&p.root().join("src/lib.rs")).unwrap()).unwrap(); a.finish().unwrap(); } diff --git a/tests/test_cargo_build_auth.rs b/tests/test_cargo_build_auth.rs index a8e88cbd1..9dcf1293c 100644 --- a/tests/test_cargo_build_auth.rs +++ b/tests/test_cargo_build_auth.rs @@ -40,7 +40,7 @@ test!(http_auth_offered { assert_eq!(req, vec![ "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1", "Accept: */*", - "User-Agent: git/1.0 (libgit2 0.22.0)", + "User-Agent: git/1.0 (libgit2 0.23.0)", ].into_iter().map(|s| s.to_string()).collect()); drop(s); @@ -55,7 +55,7 @@ test!(http_auth_offered { "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1", "Authorization: Basic Zm9vOmJhcg==", "Accept: */*", - "User-Agent: git/1.0 (libgit2 0.22.0)", + "User-Agent: git/1.0 (libgit2 0.23.0)", ].into_iter().map(|s| s.to_string()).collect()); }); @@ -93,7 +93,7 @@ test!(http_auth_offered { "#, addr.port())) .file("src/main.rs", ""); - assert_that(p.cargo_process("build").arg("-v"), + assert_that(p.cargo_process("build"), execs().with_status(101).with_stdout(&format!("\ {updating} git repository `http://{addr}/foo/bar` ", @@ -107,7 +107,9 @@ Caused by: failed to clone into: [..] Caused by: - [..] status code: 401 + failed to authenticate when downloading repository + +To learn more, run the command again with --verbose. ", addr = addr))); @@ -152,8 +154,9 @@ Caused by: ", addr = addr, errmsg = if cfg!(windows) { - "[[..]] failed to send request: The connection with the server \ - was terminated abnormally\n" + "[[..]] failed to send request: [..]\n" + } else if cfg!(target_os = "macos") { + "[[..]] unexpected return value from ssl handshake [..]" } else { "[[..]] SSL error: [..]" }))); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index b48445dbd..ca147db34 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1780,7 +1780,8 @@ test!(rustc_env_var { Could not execute process `rustc-that-does-not-exist -vV` ([..]) Caused by: -[..]".to_string() + if cfg!(windows) {"\n[..]\n"} else {"\n"})); +[..] +")); assert_that(&p.bin("a"), is_not(existing_file())); }); diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index 2f73a2f4e..34d2e37f9 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -921,11 +921,12 @@ test!(dep_with_changed_submodule { sub.sync().unwrap(); { let subrepo = sub.open().unwrap(); + subrepo.remote_add_fetch("origin", + "refs/heads/*:refs/heads/*").unwrap(); + subrepo.remote_set_url("origin", + &git_project3.url().to_string()).unwrap(); let mut origin = subrepo.find_remote("origin").unwrap(); - origin.set_url(&git_project3.url().to_string()).unwrap(); - origin.add_fetch("refs/heads/*:refs/heads/*").unwrap();; - origin.fetch(&[], None).unwrap(); - origin.save().unwrap(); + origin.fetch(&[], None, None).unwrap(); let id = subrepo.refname_to_id("refs/remotes/origin/master").unwrap(); let obj = subrepo.find_object(id, None).unwrap(); subrepo.reset(&obj, git2::ResetType::Hard, None).unwrap(); diff --git a/tests/test_cargo_doc.rs b/tests/test_cargo_doc.rs index 46be1eeba..7464e3774 100644 --- a/tests/test_cargo_doc.rs +++ b/tests/test_cargo_doc.rs @@ -266,6 +266,8 @@ test!(doc_same_name { test!(doc_target { const TARGET: &'static str = "arm-unknown-linux-gnueabihf"; + if !::is_nightly() { return } + let p = project("foo") .file("Cargo.toml", r#" [package] @@ -274,8 +276,8 @@ test!(doc_target { authors = [] "#) .file("src/lib.rs", r#" - #![feature(no_std)] - #![no_std] + #![feature(no_core)] + #![no_core] extern { pub static A: u32; diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index 43b21e261..5ca6b1cf6 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -57,10 +57,11 @@ src[..]main.rs let ar = Archive::new(Cursor::new(contents)); for f in ar.files().unwrap() { let f = f.unwrap(); - let fname = f.filename_bytes(); + let fname = f.header().path_bytes(); + let fname = &*fname; assert!(fname == b"foo-0.0.1/Cargo.toml" || fname == b"foo-0.0.1/src/main.rs", - "unexpected filename: {:?}", f.filename()) + "unexpected filename: {:?}", f.header().path()) } }); @@ -363,9 +364,10 @@ src[..]main.rs let ar = Archive::new(Cursor::new(contents)); for f in ar.files().unwrap() { let f = f.unwrap(); - let fname = f.filename_bytes(); + let fname = f.header().path_bytes(); + let fname = &*fname; assert!(fname == b"nested-0.0.1/Cargo.toml" || fname == b"nested-0.0.1/src/main.rs", - "unexpected filename: {:?}", f.filename()) + "unexpected filename: {:?}", f.header().path()) } }); diff --git a/tests/test_cargo_publish.rs b/tests/test_cargo_publish.rs index ada46bbc5..5e35c482a 100644 --- a/tests/test_cargo_publish.rs +++ b/tests/test_cargo_publish.rs @@ -80,10 +80,11 @@ test!(simple { let ar = Archive::new(inner); for file in ar.files().unwrap() { let file = file.unwrap(); - let fname = file.filename_bytes(); + let fname = file.header().path_bytes(); + let fname = &*fname; assert!(fname == b"foo-0.0.1/Cargo.toml" || fname == b"foo-0.0.1/src/main.rs", - "unexpected filename: {:?}", file.filename()) + "unexpected filename: {:?}", file.header().path()); } }); -- 2.30.2